import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:framelib/base/base_view.dart';
import 'package:framelib/utils/color_util.dart';
import 'package:framelib/utils/px_util.dart';
import 'package:framelib/widgets/nosize_app_bar.dart';
import 'package:framelib/widgets/page_widget_manager.dart';
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:module_business/my/viewmodel/my_view_model.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class MyPage extends GetWidget {
  @override
  Widget build(BuildContext context) {
    return PageTabBuild<MyViewModel>(
        initController: Get.put(MyViewModel(), tag: 'MyViewModel'),
        tag: 'MyViewModel',
        builder: (viewModel) {
          return PageWidgetManager.buildPage(context: context,
            backgroundColor: color_white,
            appBar: NoSizeAppBar(
              backgroundColor: color_main,
              statusColor: color_white,
            ),
            body: Container(
              width: MediaQuery.sizeOf(context).width,
              height: MediaQuery.sizeOf(context).height,
              decoration: BoxDecoration(
                  gradient: LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [
                        color_main_half,
                        color_main_half_2,
                      ]
                  )
              ),
              child: Stack(
                children: [
                  //顶部背景
                  _buildTopBgUi(context,viewModel),

                  Container(
                    width: MediaQuery.sizeOf(context).width,
                    height: MediaQuery.sizeOf(context).height,
                    child: Column(
                      children: [

                      ],
                    ),
                  )
                ],
              ),
            ),
          );
        });
  }

  _buildTopBgUi(BuildContext context, MyViewModel viewModel) {
    return Container(
      width: MediaQuery.sizeOf(context).width,
      height: px_260.h,
      decoration: BoxDecoration(
          color: color_main,
          borderRadius: BorderRadius.only(
            bottomLeft: Radius.circular(px_36.w),
            bottomRight: Radius.circular(px_36.w),
          )
      ),
    );
  }
}
